Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#397 : "More from this model" image preview section #408

Merged
merged 11 commits into from
Sep 23, 2019

Conversation

konarshankar07
Copy link
Contributor

Description (*)

This PR is regarding addition of more from this model section in the image preview

Fixed Issues (if relevant)

  1. "More from this model" image preview section #397: "More from this model" image preview section.

Manual testing scenarios (*)

  1. Login to admin panel
  2. Open Magento Media Gallery (i.e. go to Cms -> Pages, edit the page and insert image)
  3. Click "Search Adobe Stock" button to open images grid
  4. Click on any image

Actual Result

image
image

Copy link
Member

@sivaschenko sivaschenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @konarshankar07 thanks for the pull request! Please take a look at the review comments

/*
* Series ID.
*/
const SERIE_ID = 'serie_id';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid code duplication, it's better to use the field as a method parameter or as a constructor parameter provided by DI and use cycles instead of similar code blocks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @sivaschenko ,

We can avoid code duplication by replacing Magento\Framework\Api\Search\SearchCriteriaBuilder to Magento\Framework\Api\SearchCriteriaBuilder so that we can pass array of filter but we have already used Magento\Framework\Api\Search\SearchCriteriaBuilder in so many places that there are lot of chance some functionality might broke. Let me know if you want to move forward with this logic or any other logic from your side is always welcome

Thanks!

/**
* Returns series to display under the image
*
* @param record
* @returns {*[]}
*/
getSeries: function (record) {
if (!record.series) {
if (!record.series || !record.model) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's better to process series and same model images separately (i.e. use a loop)

Copy link
Member

@sivaschenko sivaschenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @konarshankar07 thanks for updates.

Please take a look at my commit with removed code duplication and see a couple of additional comments in this code review.

Also please pay attention that GetImageSeriesTest has to be adjusted

<!-- ko foreach: $col.getSeries($row()) -->
<div class="thumbnail" data-bind="css: { 'hide': $index() >= 3}">
<img attr="src: thumbnail_url, alt: title">
<div id="adobe-stock-tabs" attr="'data-mage-init': getDataMageInit()">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is incorrect usage of data-mage-init attribute. I think data-mage-init attribute should be static in this case.

<div id="adobe-stock-tabs" attr="'data-mage-init': getDataMageInit()">
<ul class="tabs-horiz">
<li>
<a href="#series_content" id="series_tab">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there are multiple tabs per page, I'd suggest using unique ids (i.e. appending image id or index)

$this->getImageList->execute($serieSearchCriteria)->getItems(),
$this->getImageList->execute($modelSearchCriteria)->getItems()
);
foreach ($this->fields as $key => $field) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can still refactor the code using the filter group for better searching. Please see devdocs for more information in order to do that we need to change SearchCriteriaBuilder interface which I mention in the previous comment. Correct me if I'm wrong.
Thanks

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion! Do you mean we might have been able to add both filters to a single filter group and perform a single request? I don't think that will be possible considering that it's required to keep the related image groups separate.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think you are right. I tried to implement and failed to achieve the expected result

@konarshankar07
Copy link
Contributor Author

Hello @sivaschenko ,
Thanks for helping me out. Please check my comment on the "removed code duplication" commit. I'll continue to work on other requested changes

@konarshankar07
Copy link
Contributor Author

Hello @sivaschenko ,
I'm not able to find the reference file for GetImageSeriesTest. Do I need to write the unit testing for GetImageList and remove the GetImageSeriesTest?
Thanks

@sivaschenko
Copy link
Member

@konarshankar07 here is the file https://github.com/magento/adobe-stock-integration/blob/develop/AdobeStockImage/Test/Unit/Model/GetImageSeriesTest.php

That test is causing build failure and has to be corrected

@konarshankar07
Copy link
Contributor Author

Hello @sivaschenko ,
I'm not able to check the status for this travis automated status for this PR. Can you please check why its not showing?
Here is the screeshot
image

Thanks

@sivaschenko
Copy link
Member

Hi @konarshankar07 I believe that is because of conflicts

@sivaschenko sivaschenko merged commit 7bcf165 into magento:develop Sep 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants